import requests

# 替换为你的百度地图API密钥
api_key = 'adz0Cd6uyhQScCwVYG3bPaFRXc6hg64R'



import requests

def get_location(address):
    url = "http://api.map.baidu.com/geocoding/v3/"
    ak = api_key # 替换成你自己的百度地图API密钥
    params = {
        "address": address,
        "ak": ak
    }
    response = requests.get(url, params=params)
    data = response.json()

    if data["status"] == 0:
        location = data["result"]["location"]
        print("经度：", location["lng"])
        print("纬度：", location["lat"])
    else:
        print("查询失败")

address = input("请输入地理位置：")
get_location(address)